package darknet.application.chat.spec;

import darknet.application.Application;
import java.io.IOException;
import java.util.Set;

/**
 * Define a chat application.
 * 
 * @author Yoyo
 */
public interface ChatApplication extends Application, ObservableChat {

    /**
     * Create a session with a node.
     *
     * @param nodeName
     * @return
     * @throws IOException
     */
    Session createSession(String nodeName) throws IOException;

    /**
     * Create a channel hosted on the node.
     *
     * @param channelName The channel name.
     * @return 
     */
    Channel createChannel(String channelName);

    /**
     * Get joined channels.
     * @return
     */
    Set<Channel> getJoinedChannels();

    /**
     * Get self-hosted channels.
     * @return
     */
    Set<Channel> getHostedChannels();

     /**
     * Get all channels available on the network, including your own channels.
      *
     * @return 
     * @throws IOException
     */
    Set<Channel> getChannels() throws IOException;

    /**
     * Get a channel via a channel name.
     * The channel returned can be local (self-hosted) or
     * netword (hosted in another node).
     *
     * @param channelName   The channel name
     * @return The channel
     */
    Channel getChannel(String channelName) throws IOException;

    /**
     * Get all session created or received.
     * @return
     */
    Set<Session> getSessions();
}
